<?php
/**
 * Created by PhpStorm.
 * User: 低调
 * Date: 2018/5/23
 * Time: 23:27
 */
//所有文章列表
include("../connectdb.php");
include("head.php");
$username = $_SESSION['id'];
$sql = "SELECT * FROM Article WHERE uid='$id'";
$result=mysqli_query($conn,$sql);
$arr = array();
while($row=mysqli_fetch_array($result, MYSQLI_NUM)){
    $arr[]=$row;
}
?>
<!-- 内容区域 -->
<div class="tpl-content-wrapper">
    <div class="row-content am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title  am-cf">所有文章列表</div>
                    </div>
                    <div class="widget-body  am-fr">

                        <div class="am-u-sm-12">
                            <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                                <thead>
                                <tr>
                                    <th>id</th>
                                    <th>Title</th>
                                    <th>作者</th>
                                    <th>类型</th>
                                    <th>状态</th>
                                    <th>时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                <?php foreach($arr as $data):?>
                                    <tr class="gradeX">
                                        <td><?php echo $data[0];?></td>
                                        <td><?php echo $data[4];?></td>
                                        <td><?php echo $data[2];?></td>
                                        <td><?php echo $data[3];?></td>
                                        <td><?php if($data[7]==1){echo "正常";}elseif($data[7]==2){echo "隐藏";}else{echo "禁用";}?></td>
                                        <td><?php echo $data[5];?></td>
                                        <td>
                                            <div class="tpl-table-black-operation">
                                                <?php if($data[7]==2)
                                                    echo"
                                                        <a href='common.php?id=$data[0]&kind=2'>
                                                        <i class='am-icon-pencil'></i> 公开
                                                        </a>";
                                                else
                                                    echo "
                                                        <a href='common.php?id=$data[0]&kind=0'>
                                                        <i class='am-icon-pencil'></i> 隐藏
                                                        </a>";
                                                ?>
                                                <a href="detail.php?id=<?php echo $data[0];?>">
                                                    <i class="am-icon-pencil"></i> 查看
                                                </a>
                                                <a href="modify.php?id=<?php echo $data[0];?>">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                                <a href="common.php?id=<?php echo $data[0];?>&kind=1" class="tpl-table-black-operation-del">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach;?>

                                </tbody>
                            </table>
                        </div>
                        <div class="am-u-lg-12 am-cf">

                            <div class="am-fr">
                                <ul class="am-pagination tpl-pagination">
                                    <li class="am-disabled"><a href="#">«</a></li>
                                    <li class="am-active"><a href="#">1</a></li>
                                    <li><a href="#">2</a></li>
                                    <li><a href="#">3</a></li>
                                    <li><a href="#">4</a></li>
                                    <li><a href="#">5</a></li>
                                    <li><a href="#">»</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
